from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Any, List, Optional


class CrudResponseModel(BaseModel):
    """
    操作响应模型
    """
    is_success: bool = Field(default=True, title="操作是否成功")
    message: Optional[str] = Field(default=None, title="响应信息")
    result: Optional[Any] = Field(default=None, title="响应结果")


class UploadResponseModel(BaseModel):
    """
    上传响应模型
    """

    model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)

    file_name: Optional[str] = Field(default=None, description="文件名")
    new_file_name: Optional[str] = Field(default=None, description="新文件名")
    original_filename: Optional[str] = Field(default=None, description="原始文件名")
    url: Optional[str] = Field(default=None, description="新文件url")
